// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Live Stream API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_video_livestream_v1::client::LivestreamService;
/// let client = LivestreamService::builder().build().await?;
/// // use `client` to make requests to the Live Stream API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Using Live Stream API, you can generate live streams in the various
/// renditions and streaming formats. The streaming format include HTTP Live
/// Streaming (HLS) and Dynamic Adaptive Streaming over HTTP (DASH). You can send
/// a source stream in the various ways, including Real-Time Messaging
/// Protocol (RTMP) and Secure Reliable Transport (SRT).
///
/// # Configuration
///
/// To configure `LivestreamService` use the `with_*` methods in the type returned
/// by [builder()][LivestreamService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://livestream.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::livestream_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::livestream_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `LivestreamService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `LivestreamService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct LivestreamService {
    inner: std::sync::Arc<dyn super::stub::dynamic::LivestreamService>,
}

impl LivestreamService {
    /// Returns a builder for [LivestreamService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_video_livestream_v1::client::LivestreamService;
    /// let client = LivestreamService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::livestream_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::livestream_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::LivestreamService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::LivestreamService>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::LivestreamService> {
        super::transport::LivestreamService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::LivestreamService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::LivestreamService::new)
    }

    /// Creates a channel with the provided unique ID in the specified
    /// region.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_channel(&self) -> super::builder::livestream_service::CreateChannel {
        super::builder::livestream_service::CreateChannel::new(self.inner.clone())
    }

    /// Returns a list of all channels in the specified region.
    pub fn list_channels(&self) -> super::builder::livestream_service::ListChannels {
        super::builder::livestream_service::ListChannels::new(self.inner.clone())
    }

    /// Returns the specified channel.
    pub fn get_channel(&self) -> super::builder::livestream_service::GetChannel {
        super::builder::livestream_service::GetChannel::new(self.inner.clone())
    }

    /// Deletes the specified channel.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_channel(&self) -> super::builder::livestream_service::DeleteChannel {
        super::builder::livestream_service::DeleteChannel::new(self.inner.clone())
    }

    /// Updates the specified channel.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_channel(&self) -> super::builder::livestream_service::UpdateChannel {
        super::builder::livestream_service::UpdateChannel::new(self.inner.clone())
    }

    /// Starts the specified channel. Part of the video pipeline will be created
    /// only when the StartChannel request is received by the server.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn start_channel(&self) -> super::builder::livestream_service::StartChannel {
        super::builder::livestream_service::StartChannel::new(self.inner.clone())
    }

    /// Stops the specified channel. Part of the video pipeline will be released
    /// when the StopChannel request is received by the server.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn stop_channel(&self) -> super::builder::livestream_service::StopChannel {
        super::builder::livestream_service::StopChannel::new(self.inner.clone())
    }

    /// Starts distribution which delivers outputs to the destination indicated by
    /// the Distribution configuration.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn start_distribution(&self) -> super::builder::livestream_service::StartDistribution {
        super::builder::livestream_service::StartDistribution::new(self.inner.clone())
    }

    /// Stops the specified distribution.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn stop_distribution(&self) -> super::builder::livestream_service::StopDistribution {
        super::builder::livestream_service::StopDistribution::new(self.inner.clone())
    }

    /// Creates an input with the provided unique ID in the specified region.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_input(&self) -> super::builder::livestream_service::CreateInput {
        super::builder::livestream_service::CreateInput::new(self.inner.clone())
    }

    /// Returns a list of all inputs in the specified region.
    pub fn list_inputs(&self) -> super::builder::livestream_service::ListInputs {
        super::builder::livestream_service::ListInputs::new(self.inner.clone())
    }

    /// Returns the specified input.
    pub fn get_input(&self) -> super::builder::livestream_service::GetInput {
        super::builder::livestream_service::GetInput::new(self.inner.clone())
    }

    /// Deletes the specified input.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_input(&self) -> super::builder::livestream_service::DeleteInput {
        super::builder::livestream_service::DeleteInput::new(self.inner.clone())
    }

    /// Updates the specified input.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_input(&self) -> super::builder::livestream_service::UpdateInput {
        super::builder::livestream_service::UpdateInput::new(self.inner.clone())
    }

    /// Preview the streaming content of the specified input.
    pub fn preview_input(&self) -> super::builder::livestream_service::PreviewInput {
        super::builder::livestream_service::PreviewInput::new(self.inner.clone())
    }

    /// Creates an event with the provided unique ID in the specified channel.
    pub fn create_event(&self) -> super::builder::livestream_service::CreateEvent {
        super::builder::livestream_service::CreateEvent::new(self.inner.clone())
    }

    /// Returns a list of all events in the specified channel.
    pub fn list_events(&self) -> super::builder::livestream_service::ListEvents {
        super::builder::livestream_service::ListEvents::new(self.inner.clone())
    }

    /// Returns the specified event.
    pub fn get_event(&self) -> super::builder::livestream_service::GetEvent {
        super::builder::livestream_service::GetEvent::new(self.inner.clone())
    }

    /// Deletes the specified event.
    pub fn delete_event(&self) -> super::builder::livestream_service::DeleteEvent {
        super::builder::livestream_service::DeleteEvent::new(self.inner.clone())
    }

    /// Returns a list of all clips in the specified channel.
    pub fn list_clips(&self) -> super::builder::livestream_service::ListClips {
        super::builder::livestream_service::ListClips::new(self.inner.clone())
    }

    /// Returns the specified clip.
    pub fn get_clip(&self) -> super::builder::livestream_service::GetClip {
        super::builder::livestream_service::GetClip::new(self.inner.clone())
    }

    /// Creates a clip with the provided clip ID in the specified channel.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_clip(&self) -> super::builder::livestream_service::CreateClip {
        super::builder::livestream_service::CreateClip::new(self.inner.clone())
    }

    /// Deletes the specified clip job resource. This method only deletes the clip
    /// job and does not delete the VOD clip stored in Cloud Storage.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_clip(&self) -> super::builder::livestream_service::DeleteClip {
        super::builder::livestream_service::DeleteClip::new(self.inner.clone())
    }

    /// Creates a DVR session with the provided unique ID in the specified channel.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_dvr_session(&self) -> super::builder::livestream_service::CreateDvrSession {
        super::builder::livestream_service::CreateDvrSession::new(self.inner.clone())
    }

    /// Returns a list of all DVR sessions in the specified channel.
    pub fn list_dvr_sessions(&self) -> super::builder::livestream_service::ListDvrSessions {
        super::builder::livestream_service::ListDvrSessions::new(self.inner.clone())
    }

    /// Returns the specified DVR session.
    pub fn get_dvr_session(&self) -> super::builder::livestream_service::GetDvrSession {
        super::builder::livestream_service::GetDvrSession::new(self.inner.clone())
    }

    /// Deletes the specified DVR session.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_dvr_session(&self) -> super::builder::livestream_service::DeleteDvrSession {
        super::builder::livestream_service::DeleteDvrSession::new(self.inner.clone())
    }

    /// Updates the specified DVR session.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_dvr_session(&self) -> super::builder::livestream_service::UpdateDvrSession {
        super::builder::livestream_service::UpdateDvrSession::new(self.inner.clone())
    }

    /// Creates a Asset with the provided unique ID in the specified
    /// region.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_asset(&self) -> super::builder::livestream_service::CreateAsset {
        super::builder::livestream_service::CreateAsset::new(self.inner.clone())
    }

    /// Deletes the specified asset if it is not used.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_asset(&self) -> super::builder::livestream_service::DeleteAsset {
        super::builder::livestream_service::DeleteAsset::new(self.inner.clone())
    }

    /// Returns the specified asset.
    pub fn get_asset(&self) -> super::builder::livestream_service::GetAsset {
        super::builder::livestream_service::GetAsset::new(self.inner.clone())
    }

    /// Returns a list of all assets in the specified region.
    pub fn list_assets(&self) -> super::builder::livestream_service::ListAssets {
        super::builder::livestream_service::ListAssets::new(self.inner.clone())
    }

    /// Returns the specified pool.
    pub fn get_pool(&self) -> super::builder::livestream_service::GetPool {
        super::builder::livestream_service::GetPool::new(self.inner.clone())
    }

    /// Updates the specified pool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_pool(&self) -> super::builder::livestream_service::UpdatePool {
        super::builder::livestream_service::UpdatePool::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::livestream_service::ListLocations {
        super::builder::livestream_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::livestream_service::GetLocation {
        super::builder::livestream_service::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::livestream_service::ListOperations {
        super::builder::livestream_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::livestream_service::GetOperation {
        super::builder::livestream_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::livestream_service::DeleteOperation {
        super::builder::livestream_service::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::livestream_service::CancelOperation {
        super::builder::livestream_service::CancelOperation::new(self.inner.clone())
    }
}
